<?php

namespace Packages\Captcha\Http\Controllers\Client;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Packages\Captcha\Services\CaptchaService;

class CaptchaController extends Controller
{
    protected CaptchaService $captchaService;

    public function __construct(CaptchaService $captchaService)
    {
        $this->captchaService = $captchaService;
    }

    /**
     * 生成图片验证码
     *
     * @return string
     * @throws \Exception
     */
    public function captcha(Request $request)
    {

        return $this->captchaService->captcha(['number' => $request['number']]);
    }
}
